package com.cdn.allmobilestore.model;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.cdn.allmobilestore.ulti.Log;

public class AppCommentInfo
{
  public String mAppId = "";
  public String mContent = "";
  public String mId = "";
  public double mRating = 0.0D;
  public String mTime = "";
  public String mUserId = "";
  public String mUserName = "";
  public String mVersion = "";
  
  
	public AppCommentInfo() {
		
	}


	public static ArrayList<AppCommentInfo> valueOf(JSONObject json) throws JSONException {
		// TODO Auto-generated method stub		
        ArrayList<AppCommentInfo> commentList =  new ArrayList<AppCommentInfo>();
       // String categories = paramJSONObject.getString("categories");
        JSONArray jsonArr = json.getJSONArray("comments");
        if (jsonArr != null)
        {
            commentList = new ArrayList<AppCommentInfo>();
            for (int i = 0; i < jsonArr.length(); i++)
            if (!jsonArr.isNull(i))
            {
                JSONObject localJSONObject = jsonArr.getJSONObject(i);
                String comment_id = localJSONObject.getString("id");
                String user_id = localJSONObject.getString("user_id");
                String full_name = localJSONObject.getString("full_name");
                String version = localJSONObject.getString("version");
                String created_date = localJSONObject.getString("created");
                int rate = localJSONObject.getInt("rate");
                String content = localJSONObject.getString("content");
                AppCommentInfo appcommentInfo = new AppCommentInfo();
                appcommentInfo.setmContent(comment_id);
                appcommentInfo.setmRating(rate);
                appcommentInfo.setmUserId(user_id);
                appcommentInfo.setmUserName(full_name);
                appcommentInfo.setmTime(created_date);
                appcommentInfo.setmContent(content);
                appcommentInfo.setmVersion(version);
                commentList.add(appcommentInfo);
            }
        }
		return commentList;
	}


	/**
	 * @return the mAppId
	 */
	public String getmAppId() {
		return mAppId;
	}


	/**
	 * @param mAppId the mAppId to set
	 */
	public void setmAppId(String mAppId) {
		this.mAppId = mAppId;
	}


	/**
	 * @return the mContent
	 */
	public String getmContent() {
		return mContent;
	}


	/**
	 * @param mContent the mContent to set
	 */
	public void setmContent(String mContent) {
		this.mContent = mContent;
	}


	/**
	 * @return the mId
	 */
	public String getmId() {
		return mId;
	}


	/**
	 * @param mId the mId to set
	 */
	public void setmId(String mId) {
		this.mId = mId;
	}


	/**
	 * @return the mRating
	 */
	public double getmRating() {
		return mRating;
	}


	/**
	 * @param mRating the mRating to set
	 */
	public void setmRating(double mRating) {
		this.mRating = mRating;
	}


	/**
	 * @return the mTime
	 */
	public String getmTime() {
		return mTime;
	}


	/**
	 * @param mTime the mTime to set
	 */
	public void setmTime(String mTime) {
		this.mTime = mTime;
	}


	/**
	 * @return the mUserId
	 */
	public String getmUserId() {
		return mUserId;
	}


	/**
	 * @param mUserId the mUserId to set
	 */
	public void setmUserId(String mUserId) {
		this.mUserId = mUserId;
	}


	/**
	 * @return the mUserName
	 */
	public String getmUserName() {
		return mUserName;
	}


	/**
	 * @param mUserName the mUserName to set
	 */
	public void setmUserName(String mUserName) {
		this.mUserName = mUserName;
	}


	/**
	 * @return the mVersion
	 */
	public String getmVersion() {
		return mVersion;
	}


	/**
	 * @param mVersion the mVersion to set
	 */
	public void setmVersion(String mVersion) {
		this.mVersion = mVersion;
	}
}
